<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            * {padding:0px;margin:0px;}
            ul,ol {list-style: none;}

            /* 头 */
            ul li {
                width: 100px;height: 30px;
                background-color: #000;
                color: #fff;
                display: inline-block;
            }
            ul > li.active {background-color: orange; cursor: pointer;}

            /* 内容 */
            ol > li {
                width: 400px;
                height: 100px;
                background-color: green;
                display: none;
            }
            ol > li.active {display: block;}
        </style>
    </head>
    <body>
        <ul>
            <li class="active">1</li>
            <li>2</li>
            <li>3</li>
        </ul>
        
        <ol>
            <li class="active">01内容</li>
            <li>02内容</li>
            <li>03内容</li>
        </ol>


        <script>
            var ulli = document.querySelectorAll('ul>li')
            // console.log(ulli)
            ulli.forEach(function(item,index) {
                
                item.onmouseover = function() {
                    ulli.forEach(function(item,index) {
                        item.className = ''   
                    })
                    this.className = 'active'
                    var olli = document.querySelectorAll('ol>li')
                    olli.forEach(function(item,index) {
                        item.className = ''
                    })
                    olli[index].className = 'active'
                }
            })
        </script>
    </body>
</html>